Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bulkio: Correctly group producer/consumers when importing data #49995

Merged
merged 1 commit into from
Jun 9, 2020

Conversation

miretskiy
Copy link
Contributor

Fixes #49989

Correctly link data import producer and consumer when importing data.
Using separate groups for producer and consumer could lead to a situation
where consumer exits (due to an error, or explicit context cancellation), while
producer does not realize that, leading to a deadlock.

Release notes (bug fix): Correctly link producer/consumer during data
import in order to handle errors correctly.

@miretskiy miretskiy requested review from pbardea, nvanbenschoten and a team June 8, 2020 23:53
@cockroach-teamcity
Copy link
Member

This change is Reviewable

Copy link
Member

@nvanbenschoten nvanbenschoten left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This :lgtm:, but the group/producerGroup split looks deliberate enough that it warrants either a) some archeology and an explanation on this PR about why it was built that way to begin with and why the split is not actually needed, or b) a review from @spaskob, who added it in 736e88d, or c) preferably both.

Thanks again for the quick fix!

Also, I meant to ask on the other PR - you're planning on backporting both of these to release-20.1, right?

Reviewed 2 of 2 files at r1.
Reviewable status: :shipit: complete! 1 of 0 LGTMs obtained (waiting on @miretskiy and @pbardea)


pkg/ccl/importccl/import_processor_test.go, line 442 at r1 (raw file):

}

func TestImportHandlesDuplicateKVs(t *testing.T) {

Nice test.

Copy link
Contributor

@pbardea pbardea left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This also LGTM, but I agree with Nathan's proposal that this would probably benefit from a quick look from @spaskob to ensure that everything is indeed what we expect.

@spaskob
Copy link
Contributor

spaskob commented Jun 9, 2020

:lgtm:

@miretskiy
Copy link
Contributor Author

Thanks for the reviews. I did do some digging. From what I can tell, this was simply a refactoring move, trying to perturb the code the least. There used to be input finished call, which was responsible for closing kvch. The refactor removed that.

It is simply no correct to have 2 groups. The issue with deadlock was that when one of the workers in group B exits (ingetstKV returns error), the other worker responsible for
waiting for the import to finish, would never finish since workers in Group A try to write to channel that nobody reads from. There is no communication (vis-a-vis errors, and/or cancellation) between group B and A.

@spaskob
Copy link
Contributor

spaskob commented Jun 9, 2020 via email

Fixes cockroachdb#49989

Correctly link data import producer and consumer when importing data.
Using separate groups for producer and consumer could lead to a situation
where consumer exits (due to an error, or explicit context cancellation), while
producer does not realize that, leading to a deadlock.

Release notes (bug fix): Correctly link producer/consumer during data
import in order to handle errors correctly.
@miretskiy
Copy link
Contributor Author

Also, CI failures were due to the stress test because I also need the fix already submitted (to parallel producer). The newly added test also triggers the other deadlock bug #49977

@miretskiy
Copy link
Contributor Author

bors r+

@craig
Copy link
Contributor

craig bot commented Jun 9, 2020

Build succeeded

@craig craig bot merged commit 86c4fbd into cockroachdb:master Jun 9, 2020
@miretskiy miretskiy deleted the import2 branch June 9, 2020 20:48
craig bot pushed a commit that referenced this pull request Jun 12, 2020
50089: release-20.1: bulkio:  import no longer gets stuck due to errors encountered during import r=miretskiy a=miretskiy

Backport:
  * 1/1 commits from "importccl: Correctly handle errors and cancellations during import." (#49979)
  * 1/1 commits from "bulkio: Correctly group producer/consumers when importing data" (#49995)

Please see individual PRs for details.

/cc @cockroachdb/release


Co-authored-by: Yevgeniy Miretskiy <yevgeniy@cockroachlabs.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

bulkio: error from ingestKvs causes deadlock
5 participants